package com.harris.double_db;

import com.harris.double_db.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@SpringBootApplication
@RestController
public class DoubleDbApplication {

    public static void main(String[] args) {

        SpringApplication.run(DoubleDbApplication.class, args);
        System.out.println(".................server running.................");
    }

    @Autowired
    UserService userService;

    @RequestMapping(value = "/method1",method = RequestMethod.GET)
    public Map<String,Object> method1(){
        return userService.findAll();
    }

    @RequestMapping(value = "/method2",method = RequestMethod.GET)
    public Map<String,Object> method2(){
        return userService.findAllByBaseMapper();
    }

}

